package svg;

import java.awt.Color;
import java.net.URI;

public class JobCanvas extends GObject 
{
	protected int start;
	protected int length;
	protected TaskCanvas owner;
	
	/* JobCanvas:
	 * start  - starting time
	 * length - the length of the job
	 * owner  - task owning the job
	 */
	public JobCanvas(int start, int length, TaskCanvas owner)
	{
		this.start = start;
		this.length = length;
		this.owner = owner;
	}
	
	public void init(){}
	
	@Override
	public void show(URI uri) 
	{
		int height = (int)((1.0 * owner.getHeight()) / 3.0);
		JobViewer.addRectangle(uri, 
				(int)(owner.getAxisStarts().getX() + start * owner.getTimeUnit()),
				(int)owner.getAxisStarts().getY() - height, 
				(int)(length * owner.getTimeUnit()),
				height, 
				true, Color.BLUE, false, Color.BLACK, 1);
	}

	public int getStart() {
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		this.length = length;
	}

	public TaskCanvas getOwner() {
		return owner;
	}

	public void setOwner(TaskCanvas owner) {
		this.owner = owner;
	}

}
